package com.huawei.appgallery.wishlist.ui.cardkit.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.foundation.ui.framework.widget.Space;
import com.huawei.appgallery.wishlist.ui.cardkit.card.WishNormalCard;
import o.azb;
import o.cdr;
import o.chf;
import o.chm;
import o.dce.i;
import o.epr;

public class WishNormalNode extends cdr {
    public WishNormalNode(Context context) {
        super(context, 1);
        ˋ();
    }

    private void ˋ() {
        this.ʼ = 1;
        int i = chf.ˊ(this.ॱ).getConfiguration().orientation;
        if (epr.ˎ().ॱॱ() && 2 == i) {
            this.ʼ = 2;
        }
    }

    public int ˋ(Context context) {
        return azb.ॱ(context) / (this.ʼ == 0 ? 1 : this.ʼ);
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        int i = 0;
        viewGroup.setPadding(0, viewGroup.getPaddingTop(), 0, viewGroup.getPaddingBottom());
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        int ˏ = ˏ();
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        LayoutParams layoutParams2 = new LinearLayout.LayoutParams(chm.ॱ().ˎ(), -1);
        while (i < ˏ) {
            if (i != 0) {
                viewGroup.addView(new Space(this.ॱ), layoutParams2);
            }
            View inflate = from.inflate(i.ˎ, null);
            ˊ(ˎ(inflate));
            viewGroup.addView(inflate, layoutParams);
            i++;
        }
        return true;
    }

    protected WishNormalCard ˎ(View view) {
        WishNormalCard wishNormalCard = new WishNormalCard(this.ॱ);
        wishNormalCard.ˋ(ˋ(this.ॱ));
        wishNormalCard.ˏ(view);
        return wishNormalCard;
    }
}
